shared matrix WorldViewProj;

texture2D Texture;
sampler2D TextureSampler = sampler_state
{
	Texture = <Texture>;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;
	AddressU = WRAP;
	AddressV = WRAP;
};

texture2D Detail;
sampler2D DetailSampler = sampler_state
{
	Texture = <Detail>;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;
	AddressU = WRAP;
	AddressV = WRAP;
};

struct VertexInput
{
	float3 Position : POSITION;
	float2 TexCoord : TEXCOORD0;
};

struct VertexOutput
{
	float4 Position  : POSITION;
	float2 TexCoord : TEXCOORD0;
};

struct PixelInput
{
	float4 Position : POSITION;
	float3 Color : COLOR0;
};

struct PixelOutput
{
	float4 Color : COLOR0;
};

VertexOutput DiffuseVS(VertexInput input) 
{
	VertexOutput output;
	output.Position = mul( float4(input.Position, 1.0f), WorldViewProj);
	output.TexCoord = input.TexCoord;
	return output;
}

float4 DiffusePS( VertexOutput input) : COLOR0
{
	//return float4(1.0f, 1.0f,0.0f, 1.0f);
	float4 textureColor = tex2D(TextureSampler, input.TexCoord);
	float4 detailColor = tex2D(DetailSampler, input.TexCoord * 10);

	return textureColor * detailColor;
}

technique diffuse
{
	pass p0
	{
		VertexShader = compile vs_3_0 DiffuseVS();
		PixelShader  = compile ps_3_0 DiffusePS();
	}
} 
